﻿@model ProductDetailsModel
@inject CatalogSettings catalogSettings
<div class="row">
    <div class="form-group col-12">
        @if (Model.EndTime.HasValue)
        {
            <div class="countdown-box text-left p-2 bg-light">
                @if (Model.EndTime > DateTime.UtcNow)
                {
                    <label class="d-inline-block mb-0">@T("AddToCart.Timeleft"): </label>
                    <div class="d-inline-block" data-countdown="@Model.EndTime.Value.ToString("yyyy-MM-dd HH:mm UTC")"></div>
                }
                else
                {
                    <div class="d-inline-flex flex-wrap justify-content-center">
                        <label class="ended-label mb-0">@T("ShoppingCart.Auctionends"):</label>
                        <div class="count-date">@Model.EndTimeLocalTime.Value.ToString()</div>
                    </div>
                }
            </div>
        }
        @if (Model.EndTime > DateTime.UtcNow)
        {
            <div class="btn-group w-100">
                <input asp-for="HighestBidValue" type="number" class="form-control" value="@(Model.HighestBidValue > 0 ? (Model.HighestBidValue + 1).ToString(System.Globalization.CultureInfo.InvariantCulture) : (Model.StartPrice + 1).ToString(System.Globalization.CultureInfo.InvariantCulture))" />
                <button type="button" id="bid-button-@Model.Id" class="btn btn-info add-to-cart-button" data-productid="@Model.Id" onclick="AjaxCart.addbid('@Url.RouteUrl("AddBid", new { productId = Model.Id, shoppingCartTypeId = (int)ShoppingCartType.Auctions })', '#product-details-form');return false;">
                    <span class="mdi mdi-gavel mr-1"></span><span>@T("ShoppingCart.Bid")</span>
                </button>
            </div>
        }
    </div>
</div>
